package com.kk.transactional.controller;

import com.kk.transactional.entity.Order;
import com.kk.transactional.service.MultiLevelCacheService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * .
 *
 * @author o_o
 * @date 2025-06-16
 */
@RestController
@Api("订单")
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private MultiLevelCacheService multiLevelCacheService;

    @GetMapping("/get")
    @ApiOperation("查询订单")
    public Order get(String key) {
        return multiLevelCacheService.get(key, Order.class);
    }

    @ApiOperation("更新订单")
    @PutMapping("/update")
    public void update(String key) {
        multiLevelCacheService.update(key, Order.class);
    }
}
